package cn.bonoon.kernel.web.resources;

import cn.bonoon.kernel.web.html.form.AbstractEditableBuilder;
import cn.bonoon.kernel.web.models.StandardModel;

public class FormResourceRepository extends StandardResourceRepository{
	private StringBuilder beforeSubmit;
	private String formId;
	public FormResourceRepository(String name, AbstractEditableBuilder form) {
		super(name, form);
		block.append(form.getInitBlock());
		beforeSubmit = form.getInitSubmit();
		formId = form.getFormId();
	}

	@Override
	public String render(StandardModel model, String id) {
		model.addObject("formId", formId);
		model.addObject("beforeSubmit", beforeSubmit);
		return super.render(model, id);
	}

	public StringBuilder getBeforeSubmit() {
		return beforeSubmit;
	}

	public void setBeforeSubmit(StringBuilder beforeSubmit) {
		this.beforeSubmit = beforeSubmit;
	}
	
}
